package com.maserb.monitor.service.sysCode.impl;

import com.maserb.monitor.entity.SysCode;
import com.maserb.monitor.repository.SysCodeRepository;
import com.maserb.monitor.service.base.impl.JpaSpecificationServiceImpl;
import com.maserb.monitor.service.sysCode.SysCodeService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysCodeServiceImpl extends JpaSpecificationServiceImpl<SysCodeRepository,
        SysCodeRepository, SysCode, String>
        implements SysCodeService {

    @Override
    public List<SysCode> findByParent(String code) {
        SysCode sysCode = this.repository.findByCode(code);
        return this.repository.findByParent(sysCode);
    }

    @Override
    public SysCode findByName(String name) {
        return this.repository.findByName(name);
    }
}